import Vue from 'vue'
import Router from 'vue-router'

//导入底部四个主要组件
const Home = () =>
    import ('../pages/home/Home')
const Found = () =>
    import ('../pages/found/Found')
const Fair = () =>
    import ('../pages/fair/Fair')
const Profile = () =>
    import ('../pages/profile/Profile')
const Goodsdetails = () =>
    import ('../pages/home/Goodsdetails')
const Shoppingcar = () =>
    import ('../pages/car/Shoppingcar')
const Selectedinfo = () =>
    import ('../pages/car/Selectedinfo')
const Homemiddley = () =>
    import ('../pages/home/Homemiddley')
const Homemiddleper = () =>
    import ('../pages/home/Homemiddleper')
const MySelf = () =>
    import ('pages/profile/MySelf')
const SetUp = () =>
    import ('pages/profile/SetUp')
const login = () =>
    import ('pages/profile/login')
const NewUser = () =>
    import ('pages/profile/NewUser')
const ProductDetails = () =>
    import ('pages/fair/ProductDetails')
const Classify = () =>
    import ('pages/category/Classify')
const FirmOrder = () =>
    import ('pages/car/FirmOrder')

Vue.use(Router)
const routes = [
        //配置映射关系
        {
            path: '',
            redirect: '/home/sort' //默认路径
        },
        {
            path: '/home',
            component: Home,
            children: [{
                path: 'sort',
                component: Homemiddley,
            }, {
                path: 'perclothes',
                component: Homemiddleper,
            }]
        },
        {
            path: '/goodsdetails',
            component: Goodsdetails,
        },
        {
            path: '/shoppingcar',
            component: Shoppingcar

        },
        {
            path: '/category',
            component: Classify
        },
        {
            path: '/found',
            component: Found
        },
        {
            path: '/fair',
            component: Fair
        },
        {
            path: '/profile',
            component: MySelf
        },
        {
            path: '/setup',
            component: SetUp
        },
        {
            path: '/login',
            component: login
        }, {
            path: '/newuser',
            component: NewUser
        },
        {
            path: '/ProductDetails',
            component: ProductDetails
        },
        {
            path: '/FirmOrder',
            component: FirmOrder
        }
    ]
    //导出路由
export default new Router({
    routes,
    mode: 'history'
})